<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- saved from url=(0042)http://localhost:8080/easybbs/register.jsp -->
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<title>register</title>

<link href="static/css/style.css" type="text/css" rel="stylesheet">
	<script src="https://code.jquery.com/jquery-3.6.4.min.js"></script>
	<script>
		let flag=true;

	function check(name){
			$.ajax({
				type:"get",
				data:{username:name},
				url:"/bbs/check1",
				success:getResult

			});
			function getResult(data){
				if(data==1){
					$("#msg").html("<font color='#7fffd4'>用户名可使用</font>")
					flag=true;
				}else {
					$("#msg").html("<font color='red'>用户名重复</font>")
					flag=false;
				}
			}
		}
	</script>


<meta content="MSHTML 6.00.3790.4772" name="GENERATOR">
</head>
<body>



	<div align="center" class="guide">
		<!--用户注册信息填写-->
		<div>
			<form th:action="@{/insert}" method="post" name="registerform" onsubmit="return flag">
				<table class="t" width="98%" cellspacing="0" cellpadding="0" align="center">
					<tbody>
						<tr>
							<td colspan="2" class="h">必填信息</td>
						</tr>
						<tr class="tr3 f_one">
							<th>用户名<font color="red">*</font><br>
							</th>
							<th valign="top">
								<input type="text" name="name" onblur="check(this.value)"><span id="msg"></span>
							</th>
						</tr>
						<tr class="tr3 f_one">
							<th>密码<font color="red">*</font><br>
							</th>
							<th style="vertical-align: middle"><input type="password" name="password"></th>
						</tr>
						<tr class="tr3 f_one">
							<th>性别<font color="red">*</font></th>
							<th><select name="sex">
									<option value="男" selected="selected">男</option>
									<option value="女">女</option>
							</select> &nbsp; <span id="Span1"></span></th>
						</tr>
						<tr class="tr3 f_one">
							<th>Email<font color="red">*</font>
							</th>
							<th><br> <input type="text" name="email"> <br></th>
						</tr>
						<tr class="tr3 f_one">
							<th colspan="2"><br> <input type="submit" name="注册">
								<input type="reset" name="重置"> <input type="button" value="返回登录" onclick="javascript:window.location.href=&#39;index.jsp&#39;;">
								<br></th>
						</tr>
					</tbody>
				</table>
			</form>
		</div>



		<div th:include="footer :: footer"></div>

	</div>

</body></html>